import { IMediator, IAppEvent } from "../interfaces";
import { EventDispatcher } from "../event/EventDispatcher";


export class Mediator implements IMediator {
    protected event: EventDispatcher = new EventDispatcher();
    private _isDebug: boolean = false;
    constructor(isDebug: boolean = false) {
        this._isDebug = isDebug;
    }

    publish(topic: string, data: any): void {
        this.event.emit(topic, data)

    }
    subscribe(e: IAppEvent): void {
        this.event.on(e)
    }
    unsubscribe(e: IAppEvent): void {
        this.event.off(e.topic, e.handler, e.target);
    }


}